package com.sdweizan.sdk.bytedance.api.impl;

import com.alibaba.fastjson.TypeReference;
import com.sdweizan.sdk.bytedance.api.BdApiService;
import com.sdweizan.sdk.bytedance.api.BdMiniAppService;
import com.sdweizan.sdk.bytedance.bean.distribution.BdCreateReturnRequest;
import com.sdweizan.sdk.bytedance.bean.distribution.BdCreateReturnResponse;
import com.sdweizan.sdk.bytedance.bean.distribution.BdQueryReturnRequest;
import com.sdweizan.sdk.bytedance.bean.distribution.BdQueryReturnResponse;
import com.sdweizan.sdk.bytedance.bean.settle.*;
import com.sdweizan.sdk.bytedance.error.BdErrorException;
import lombok.AllArgsConstructor;

@AllArgsConstructor
public class BdSettleService {
  private final BdApiService bdApiService;

  public BdCreateSettleResponse createSettle(BdCreateSettleRequest bdCreateSettleRequest)
      throws BdErrorException {
    return bdApiService.post(bdCreateSettleRequest, new TypeReference<BdCreateSettleResponse>() {});
  }

  public BdQuerySettleResponse querySettle(BdQuerySettleRequest bdQuerySettleRequest)
      throws BdErrorException {
    return bdApiService.post(bdQuerySettleRequest, new TypeReference<BdQuerySettleResponse>() {});
  }

  public BdCreateReturnResponse createReturn(BdCreateReturnRequest bdCreateReturnRequest)
      throws BdErrorException {
    return bdApiService.post(bdCreateReturnRequest, new TypeReference<BdCreateReturnResponse>() {});
  }

  public BdQueryReturnResponse queryReturn(BdQueryReturnRequest bdQueryReturnRequest)
      throws BdErrorException {
    return bdApiService.post(bdQueryReturnRequest, new TypeReference<BdQueryReturnResponse>() {});
  }

  public BdQueryPlatformResponse queryPlatform(BdQueryPlatformRequest bdQueryPlatformRequest)
      throws BdErrorException {
    return bdApiService.post(
        bdQueryPlatformRequest, new TypeReference<BdQueryPlatformResponse>() {});
  }

  public BdUnsettleAmountResponse unsettleAmount(BdUnsettleAmountRequest bdUnsettleAmountRequest)
      throws BdErrorException {
    return bdApiService.post(
        bdUnsettleAmountRequest, new TypeReference<BdUnsettleAmountResponse>() {});
  }
}
